package com.example.xd.model_net;

import android.Manifest;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.example.xd.commen.ARouterPath;
import com.example.xd.commen.annotation.FloatAnn;
import com.example.xd.commen.annotation.Privilege;
import com.example.xd.commen.bean.TestBean;

import java.util.ArrayList;

@FloatAnn
@Route(path = "/model_net/NetActivity")
@Privilege(value = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE})
public class NetActivity extends AppCompatActivity {
    @Autowired
    public String text;
    @Autowired
    public ArrayList<TestBean> list;
    @Autowired
    public TestBean bean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.net_activity_main);
        ARouter.getInstance().inject(this);
        TextView tv = findViewById(R.id.tv);
        tv.setText(text);
        activity = this;
        Log.i("xd----", "bean" + "--------" + bean.getAge() + "---" + bean.getName());
        for (int i = 0; i < list.size(); i++) {
            TestBean testBean = list.get(i);
            Log.i("xd----", "list" + i + "--------" + testBean.getAge() + "---" + testBean.getName());

        }
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ARouter.getInstance()
                        .build("/model_permission/PermissionActivity")
                        .withString("text", "net")
                        .navigation();
            }
        });

    }

    public static Activity activity;

    public static Activity getThis() {
        return activity;
    }
}
